package com.smh.a10ThreadDemo10;

public class ThreadDemo1 {
    public static void main(String[] args) {

//        MyThread t = new MyThread();
//        t.start();
//        MyThread t2 = new MyThread();
//        t2.start();

        MyRunnable r = new MyRunnable();
        Thread t3 = new Thread(r);
        Thread t4 = new Thread(r);
        Thread t5 = new Thread(r);
        t3.start();
        t4.start();
        t5.start();

        StringBuilder sb = new StringBuilder();//同步不安全
        StringBuffer sb2 = new StringBuffer();//同步安全
        //因为他的每个方法都上锁了
        //两个对象的方法基本一样


    }
}
